import { observable, action, toJS } from 'mobx';
import { WeaLocaleProvider } from 'ecCom';
import { WeaTableNew } from 'comsMobx';

const getLabel = WeaLocaleProvider.getLabel;
import Apis from '../apis/Api';

export default class DemoStore {
    @observable logType;
    @observable logSmallType;
    @observable targetId;
    @observable detailVisible = false;
    @observable detailRecord = {};
    @observable showParams = false;
    @observable detailKey = `${new Date().getTime()}`;
    @observable detailTitle = '';
    @observable viewdetailColums = [];
    @observable viewdetailDatas = [];
    @observable viewdetailTitles = [];

    @action
    update = (object) => {
      if (Object.prototype.toString.call(object) === '[object Object]') {
        for (const key in object) {
          if (object.hasOwnProperty(key)) {
            this[key] = object[key];
          }
        }
      }
      return this;
    };


    setDetailVisible(bool) {
      this.detailVisible = bool;
    }

    setDetailTitle(name = '') {
      this.detailTitle = name;
    }

    setDetailRecord(obj = {}) {
      this.detailRecord = { ...obj };
    }

    setShowParams(bool = false) {
      this.showParams = bool;
    }

    updateDetailkey(key = '') {
      this.detailKey = key;
    }
}

